//:C07:FileEditor.cpp {O}
#include <fstream>
#include <ostream>
#include <string>
#include "FileEditor.h"
#include "../require.h"
using namespace std;

void FileEditor::open(const char* filename)
{
    ifstream in(filename);
    assure(in, filename);
    string line;
    while(getline(in, line))
    {
        push_back(line);
    }
}

// Could also use copy() here:
void FileEditor::write(ostream& out)
{
    for(iterator w = begin(); w != end(); w++)
    {
        out << *w << endl;
    }
}